package edu.gatech.oad.antlab.person;

import java.awt.EventQueue;

import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import java.awt.GridBagLayout;
import javax.swing.JTextPane;
import java.awt.GridBagConstraints;
import javax.swing.JTextField;
import java.awt.Insets;
import javax.swing.JRadioButton;
import javax.swing.ButtonGroup;

import java.awt.Color;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JLabel;

/**
 * Create a frame that holds the panels for our GUI. The panels hold the text
 * boxes, radio buttons, and text fields. This will allow the player to
 * configure their loading screen.
 * 
 * @author Browntourage
 * 
 */
public class StoreScreen extends JFrame {
	// Declare all the text fields, radiobuttons, textpanes, player control and
	// profession class.

	private JPanel contentPane;
	private PlayerControl pControl;
	private Wagon wagon;
	private Supplies supplies;
	private JRadioButton rdbtnBuy;
	private JRadioButton rdbtnSell;
	private final ButtonGroup buySell = new ButtonGroup();

	private int bulletPrice = 5;
	private int bottlePrice = 2;
	private int mealPrice = 5;
	private int animalPrice = 15;
	private int wheelPrice = 10;
	private int axlePrice = 5;
	private int tonguePrice = 10;

	private int bulletWeight = 1;
	private int bottleWeight = 1;
	private int mealWeight = 3;
	private int animalWeight = 70;
	private int wheelWeight = 10;
	private int axleWeight = 5;
	private int tongueWeight = 5;
	
	private JTextPane txtpnStore;
	private JTextPane txtpnBrowntourage;
	private boolean isBuy = true;

	private JTextPane txtpnAmmunition;
	private JTextPane txtpnbullet;
	private JTextField textFieldAmmunition;
	private JTextPane txtpnAmmunitionCost;

	private JTextPane txtpnMedicine;
	private JTextPane txtpnbottle;
	private JTextField textFieldMedicine;
	private JTextPane txtpnMedicineCost;

	private JTextPane txtpnFood;
	private JTextPane txtpnmeal;
	private JTextField textFieldFood;
	private JTextPane txtpnFoodCost;

	private JTextPane txtpnOxen;
	private JTextPane txtpnanimal;
	private JTextField textFieldOxen;
	private JTextPane txtpnOxenCost;

	private JTextPane txtpnWagonParts;

	private JTextPane txtpnWheel;
	private JTextPane txtpnwheel;
	private JTextField textFieldWheel;
	private JTextPane txtpnWheelCost;

	private JTextPane txtpnAxle;
	private JTextPane txtpnaxle;
	private JTextField textFieldAxle;
	private JTextPane txtpnAxleCost;

	private JTextPane txtpnTongue;
	private JTextPane txtpntongue;
	private JTextField textFieldTongue;
	private JTextPane txtpnTongueCost;

	private JTextPane txtpnCostLabel;
	private JTextPane txtpnTotalCost;
	private JTextPane txtpnTotalWeight;
	private JTextPane txtpnWeightLabel;

	private JButton btnCalculate;
	private JButton btnSealTheDeal;
	private JLabel lblCurrentMoney;
	private JLabel lblCurrentWeight;
	private JLabel lblMaxWeight;

	/*	*//**
	 * Launch the application. Create a main so that the panel can be
	 * launched on the frame.
	 */
	/*
	 * public static void main(String[] args) { EventQueue.invokeLater(new
	 * Runnable() { public void run() { try { Profession prof = null; Wagon
	 * wagon = null; StoreScreen frame = new StoreScreen(prof, wagon);
	 * frame.setVisible(true); } catch (Exception e) { e.printStackTrace(); } }
	 * }); }
	 */

	/**
	 * Create the frame.
	 */
	public StoreScreen(PlayerControl pControl, Wagon wagon) {
		this.wagon = wagon;
		this.pControl = pControl;
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		setBounds(100, 100, 661, 592);
		contentPane = new JPanel();
		contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
		contentPane.setBackground(Color.orange);
		setContentPane(contentPane);
		GridBagLayout gbl_contentPane = new GridBagLayout();
		gbl_contentPane.columnWidths = new int[] { 0, 0, 0, 0, 0, 0, 0, 0, 0,
				127, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
		gbl_contentPane.rowHeights = new int[] { 25, 0, 0, 0, 25, 0, 0, 0, 25,
				25, 25, 25, 25, 25, 25, 25, 22, 25, 22, 26, 25, 0, 0, 0, 0 };
		gbl_contentPane.columnWeights = new double[] { 0.0, 0.0, 0.0, 0.0, 1.0,
				1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0,
				0.0, 0.0, 1.0, Double.MIN_VALUE };
		gbl_contentPane.rowWeights = new double[] { 1.0, 0.0, 0.0, 0.0, 1.0,
				0.0, 0.0, 0.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 0.0,
				0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, Double.MIN_VALUE };
		contentPane.setLayout(gbl_contentPane);
		ButtonListener listener = new ButtonListener();
		CalculateListener calculateListener = new CalculateListener();

		txtpnStore = new JTextPane();
		txtpnStore.setEditable(false);
		txtpnStore.setText("Hello! How may we help you?");
		GridBagConstraints gbc_txtpnStore = new GridBagConstraints();
		gbc_txtpnStore.insets = new Insets(0, 0, 5, 5);
		gbc_txtpnStore.fill = GridBagConstraints.BOTH;
		gbc_txtpnStore.gridx = 9;
		gbc_txtpnStore.gridy = 0;
		contentPane.add(txtpnStore, gbc_txtpnStore);

		rdbtnBuy = new JRadioButton("Buy");
		rdbtnBuy.setBackground(Color.orange);
		rdbtnBuy.addActionListener(listener);

		lblCurrentMoney = new JLabel("Current Money: " + pControl.getCash());
		GridBagConstraints gbc_lblCurrentMoney = new GridBagConstraints();
		gbc_lblCurrentMoney.insets = new Insets(0, 0, 5, 5);
		gbc_lblCurrentMoney.gridx = 14;
		gbc_lblCurrentMoney.gridy = 0;
		contentPane.add(lblCurrentMoney, gbc_lblCurrentMoney);

		lblCurrentWeight = new JLabel("Current Weight: " + wagon.getWeight());
		GridBagConstraints gbc_lblCurrentWeight = new GridBagConstraints();
		gbc_lblCurrentWeight.insets = new Insets(0, 0, 5, 5);
		gbc_lblCurrentWeight.gridx = 14;
		gbc_lblCurrentWeight.gridy = 1;
		contentPane.add(lblCurrentWeight, gbc_lblCurrentWeight);

		lblMaxWeight = new JLabel("Max Weight: 100.00");
		GridBagConstraints gbc_lblMaxWeight = new GridBagConstraints();
		gbc_lblMaxWeight.insets = new Insets(0, 0, 5, 5);
		gbc_lblMaxWeight.gridx = 14;
		gbc_lblMaxWeight.gridy = 2;
		contentPane.add(lblMaxWeight, gbc_lblMaxWeight);
		buySell.add(rdbtnBuy);
		GridBagConstraints gbc_rdbtnBuy = new GridBagConstraints();
		gbc_rdbtnBuy.insets = new Insets(0, 0, 5, 5);
		gbc_rdbtnBuy.anchor = GridBagConstraints.WEST;
		gbc_rdbtnBuy.gridx = 5;
		gbc_rdbtnBuy.gridy = 4;
		contentPane.add(rdbtnBuy, gbc_rdbtnBuy);

		rdbtnSell = new JRadioButton("Sell");
		rdbtnSell.setBackground(Color.orange);
		rdbtnSell.addActionListener(listener);
		buySell.add(rdbtnSell);
		GridBagConstraints gbc_rdbtnSell = new GridBagConstraints();
		gbc_rdbtnSell.insets = new Insets(0, 0, 5, 5);
		gbc_rdbtnSell.anchor = GridBagConstraints.WEST;
		gbc_rdbtnSell.gridx = 12;
		gbc_rdbtnSell.gridy = 4;
		contentPane.add(rdbtnSell, gbc_rdbtnSell);

		/**
		 * Ammunition
		 */

		txtpnAmmunition = new JTextPane();
		txtpnAmmunition.setText("Ammunition");
		GridBagConstraints gbc_txtpnAmmunition = new GridBagConstraints();
		gbc_txtpnAmmunition.gridwidth = 4;
		gbc_txtpnAmmunition.insets = new Insets(0, 0, 5, 5);
		gbc_txtpnAmmunition.fill = GridBagConstraints.BOTH;
		gbc_txtpnAmmunition.gridx = 5;
		gbc_txtpnAmmunition.gridy = 8;
		contentPane.add(txtpnAmmunition, gbc_txtpnAmmunition);

		txtpnbullet = new JTextPane();
		txtpnbullet.setText("Price: $" + bulletPrice + "/bullet, Weight: "
				+ bulletWeight + "pounds/bullet");
		GridBagConstraints gbc_txtpnbullet = new GridBagConstraints();
		gbc_txtpnbullet.insets = new Insets(0, 0, 5, 5);
		gbc_txtpnbullet.fill = GridBagConstraints.BOTH;
		gbc_txtpnbullet.gridx = 9;
		gbc_txtpnbullet.gridy = 8;
		contentPane.add(txtpnbullet, gbc_txtpnbullet);

		textFieldAmmunition = new JTextField();
		textFieldAmmunition.setText("0");
		GridBagConstraints gbc_textFieldAmmuntion = new GridBagConstraints();
		gbc_textFieldAmmuntion.anchor = GridBagConstraints.ABOVE_BASELINE;
		gbc_textFieldAmmuntion.gridwidth = 4;
		gbc_textFieldAmmuntion.insets = new Insets(0, 0, 5, 5);
		gbc_textFieldAmmuntion.fill = GridBagConstraints.HORIZONTAL;
		gbc_textFieldAmmuntion.gridx = 12;
		gbc_textFieldAmmuntion.gridy = 8;
		contentPane.add(textFieldAmmunition, gbc_textFieldAmmuntion);
		textFieldAmmunition.setColumns(10);

		txtpnAmmunitionCost = new JTextPane();
		txtpnAmmunitionCost.setEditable(false);
		GridBagConstraints gbc_txtpnAmmunitionCost = new GridBagConstraints();
		gbc_txtpnAmmunitionCost.gridwidth = 4;
		gbc_txtpnAmmunitionCost.insets = new Insets(0, 0, 5, 5);
		gbc_txtpnAmmunitionCost.fill = GridBagConstraints.BOTH;
		gbc_txtpnAmmunitionCost.gridx = 16;
		gbc_txtpnAmmunitionCost.gridy = 8;
		contentPane.add(txtpnAmmunitionCost, gbc_txtpnAmmunitionCost);

		/**
		 * Medicine
		 */

		txtpnMedicine = new JTextPane();
		txtpnMedicine.setText("Medicine");
		GridBagConstraints gbc_txtpnMedicine = new GridBagConstraints();
		gbc_txtpnMedicine.gridwidth = 4;
		gbc_txtpnMedicine.insets = new Insets(0, 0, 5, 5);
		gbc_txtpnMedicine.fill = GridBagConstraints.BOTH;
		gbc_txtpnMedicine.gridx = 5;
		gbc_txtpnMedicine.gridy = 9;
		contentPane.add(txtpnMedicine, gbc_txtpnMedicine);

		txtpnbottle = new JTextPane();
		txtpnbottle.setText("Price: $" + bottlePrice + "/bottle, Weight: "
				+ bottleWeight + "pounds/bottle");
		GridBagConstraints gbc_txtpnbottle = new GridBagConstraints();
		gbc_txtpnbottle.insets = new Insets(0, 0, 5, 5);
		gbc_txtpnbottle.fill = GridBagConstraints.BOTH;
		gbc_txtpnbottle.gridx = 9;
		gbc_txtpnbottle.gridy = 9;
		contentPane.add(txtpnbottle, gbc_txtpnbottle);

		textFieldMedicine = new JTextField();
		textFieldMedicine.setText("0");
		GridBagConstraints gbc_textFieldMedicine = new GridBagConstraints();
		gbc_textFieldMedicine.anchor = GridBagConstraints.ABOVE_BASELINE;
		gbc_textFieldMedicine.gridwidth = 4;
		gbc_textFieldMedicine.insets = new Insets(0, 0, 5, 5);
		gbc_textFieldMedicine.fill = GridBagConstraints.HORIZONTAL;
		gbc_textFieldMedicine.gridx = 12;
		gbc_textFieldMedicine.gridy = 9;
		contentPane.add(textFieldMedicine, gbc_textFieldMedicine);
		textFieldMedicine.setColumns(10);

		txtpnMedicineCost = new JTextPane();
		txtpnMedicineCost.setEditable(false);
		GridBagConstraints gbc_txtpnMedicineCost = new GridBagConstraints();
		gbc_txtpnMedicineCost.gridwidth = 4;
		gbc_txtpnMedicineCost.insets = new Insets(0, 0, 5, 5);
		gbc_txtpnMedicineCost.fill = GridBagConstraints.BOTH;
		gbc_txtpnMedicineCost.gridx = 16;
		gbc_txtpnMedicineCost.gridy = 9;
		contentPane.add(txtpnMedicineCost, gbc_txtpnMedicineCost);

		/**
		 * Food
		 */

		txtpnFood = new JTextPane();
		txtpnFood.setText("Food");
		GridBagConstraints gbc_txtpnFood = new GridBagConstraints();
		gbc_txtpnFood.gridwidth = 4;
		gbc_txtpnFood.insets = new Insets(0, 0, 5, 5);
		gbc_txtpnFood.fill = GridBagConstraints.BOTH;
		gbc_txtpnFood.gridx = 5;
		gbc_txtpnFood.gridy = 10;
		contentPane.add(txtpnFood, gbc_txtpnFood);

		txtpnmeal = new JTextPane();
		txtpnmeal.setText("Price: $" + mealPrice + "/meal, Weight: "
				+ mealWeight + "pounds/meal");
		GridBagConstraints gbc_txtpnmeal = new GridBagConstraints();
		gbc_txtpnmeal.insets = new Insets(0, 0, 5, 5);
		gbc_txtpnmeal.fill = GridBagConstraints.BOTH;
		gbc_txtpnmeal.gridx = 9;
		gbc_txtpnmeal.gridy = 10;
		contentPane.add(txtpnmeal, gbc_txtpnmeal);

		textFieldFood = new JTextField();
		textFieldFood.setText("0");
		GridBagConstraints gbc_textFieldFood = new GridBagConstraints();
		gbc_textFieldFood.anchor = GridBagConstraints.ABOVE_BASELINE;
		gbc_textFieldFood.gridwidth = 4;
		gbc_textFieldFood.insets = new Insets(0, 0, 5, 5);
		gbc_textFieldFood.fill = GridBagConstraints.HORIZONTAL;
		gbc_textFieldFood.gridx = 12;
		gbc_textFieldFood.gridy = 10;
		contentPane.add(textFieldFood, gbc_textFieldFood);
		textFieldFood.setColumns(10);

		txtpnFoodCost = new JTextPane();
		txtpnFoodCost.setEditable(false);
		GridBagConstraints gbc_txtpnFoodCost = new GridBagConstraints();
		gbc_txtpnFoodCost.gridwidth = 4;
		gbc_txtpnFoodCost.insets = new Insets(0, 0, 5, 5);
		gbc_txtpnFoodCost.fill = GridBagConstraints.BOTH;
		gbc_txtpnFoodCost.gridx = 16;
		gbc_txtpnFoodCost.gridy = 10;
		contentPane.add(txtpnFoodCost, gbc_txtpnFoodCost);

		/**
		 * Oxen
		 */

		txtpnOxen = new JTextPane();
		txtpnOxen.setText("Oxen");
		GridBagConstraints gbc_txtpnOxen = new GridBagConstraints();
		gbc_txtpnOxen.gridwidth = 4;
		gbc_txtpnOxen.insets = new Insets(0, 0, 5, 5);
		gbc_txtpnOxen.fill = GridBagConstraints.BOTH;
		gbc_txtpnOxen.gridx = 5;
		gbc_txtpnOxen.gridy = 11;
		contentPane.add(txtpnOxen, gbc_txtpnOxen);

		txtpnanimal = new JTextPane();
		txtpnanimal.setText("Price: $" + animalPrice + "/animal, Weight: "
				+ animalWeight + "animal/bullet");
		GridBagConstraints gbc_txtpnanimal = new GridBagConstraints();
		gbc_txtpnanimal.insets = new Insets(0, 0, 5, 5);
		gbc_txtpnanimal.fill = GridBagConstraints.BOTH;
		gbc_txtpnanimal.gridx = 9;
		gbc_txtpnanimal.gridy = 11;
		contentPane.add(txtpnanimal, gbc_txtpnanimal);

		textFieldOxen = new JTextField();
		textFieldOxen.setText("0");
		GridBagConstraints gbc_textFieldOxen = new GridBagConstraints();
		gbc_textFieldOxen.anchor = GridBagConstraints.ABOVE_BASELINE;
		gbc_textFieldOxen.gridwidth = 4;
		gbc_textFieldOxen.insets = new Insets(0, 0, 5, 5);
		gbc_textFieldOxen.fill = GridBagConstraints.HORIZONTAL;
		gbc_textFieldOxen.gridx = 12;
		gbc_textFieldOxen.gridy = 11;
		contentPane.add(textFieldOxen, gbc_textFieldOxen);
		textFieldOxen.setColumns(10);

		txtpnOxenCost = new JTextPane();
		txtpnOxenCost.setEditable(false);
		GridBagConstraints gbc_txtpnOxenCost = new GridBagConstraints();
		gbc_txtpnOxenCost.gridwidth = 4;
		gbc_txtpnOxenCost.insets = new Insets(0, 0, 5, 5);
		gbc_txtpnOxenCost.fill = GridBagConstraints.BOTH;
		gbc_txtpnOxenCost.gridx = 16;
		gbc_txtpnOxenCost.gridy = 11;
		contentPane.add(txtpnOxenCost, gbc_txtpnOxenCost);

		/**
		 * WagonParts
		 */
		txtpnWagonParts = new JTextPane();
		txtpnWagonParts.setEditable(false);
		txtpnWagonParts.setText("Buy Wagon Parts");
		GridBagConstraints gbc_txtpnWagonParts = new GridBagConstraints();
		gbc_txtpnWagonParts.insets = new Insets(0, 0, 5, 5);
		gbc_txtpnWagonParts.fill = GridBagConstraints.BOTH;
		gbc_txtpnWagonParts.gridx = 9;
		gbc_txtpnWagonParts.gridy = 12;
		contentPane.add(txtpnWagonParts, gbc_txtpnWagonParts);

		/**
		 * Wheel
		 */

		txtpnWheel = new JTextPane();
		txtpnWheel.setText("Wheel");
		GridBagConstraints gbc_txtpnWheel = new GridBagConstraints();
		gbc_txtpnWheel.gridwidth = 4;
		gbc_txtpnWheel.insets = new Insets(0, 0, 5, 5);
		gbc_txtpnWheel.fill = GridBagConstraints.BOTH;
		gbc_txtpnWheel.gridx = 5;
		gbc_txtpnWheel.gridy = 13;
		contentPane.add(txtpnWheel, gbc_txtpnWheel);

		txtpnwheel = new JTextPane();
		txtpnwheel.setText("Price: $" + wheelPrice + "/wheel, Weight: "
				+ wheelWeight + "pounds/wheel");
		GridBagConstraints gbc_txtpnwheel = new GridBagConstraints();
		gbc_txtpnwheel.insets = new Insets(0, 0, 5, 5);
		gbc_txtpnwheel.fill = GridBagConstraints.BOTH;
		gbc_txtpnwheel.gridx = 9;
		gbc_txtpnwheel.gridy = 13;
		contentPane.add(txtpnwheel, gbc_txtpnwheel);

		textFieldWheel = new JTextField();
		textFieldWheel.setText("0");
		GridBagConstraints gbc_textFieldWheel = new GridBagConstraints();
		gbc_textFieldWheel.anchor = GridBagConstraints.ABOVE_BASELINE;
		gbc_textFieldWheel.gridwidth = 4;
		gbc_textFieldWheel.insets = new Insets(0, 0, 5, 5);
		gbc_textFieldWheel.fill = GridBagConstraints.HORIZONTAL;
		gbc_textFieldWheel.gridx = 12;
		gbc_textFieldWheel.gridy = 13;
		contentPane.add(textFieldWheel, gbc_textFieldWheel);
		textFieldWheel.setColumns(10);

		txtpnWheelCost = new JTextPane();
		txtpnWheelCost.setEditable(false);
		GridBagConstraints gbc_txtpnWheelCost = new GridBagConstraints();
		gbc_txtpnWheelCost.gridwidth = 4;
		gbc_txtpnWheelCost.insets = new Insets(0, 0, 5, 5);
		gbc_txtpnWheelCost.fill = GridBagConstraints.BOTH;
		gbc_txtpnWheelCost.gridx = 16;
		gbc_txtpnWheelCost.gridy = 13;
		contentPane.add(txtpnWheelCost, gbc_txtpnWheelCost);

		/**
		 * Axle
		 */
		txtpnAxle = new JTextPane();
		txtpnAxle.setText("Axle");
		GridBagConstraints gbc_txtpnAxle = new GridBagConstraints();
		gbc_txtpnAxle.gridwidth = 4;
		gbc_txtpnAxle.insets = new Insets(0, 0, 5, 5);
		gbc_txtpnAxle.fill = GridBagConstraints.BOTH;
		gbc_txtpnAxle.gridx = 5;
		gbc_txtpnAxle.gridy = 14;
		contentPane.add(txtpnAxle, gbc_txtpnAxle);

		txtpnaxle = new JTextPane();
		txtpnaxle.setText("Price: $" + axlePrice + "/axle, Weight: "
				+ axleWeight + "pounds/axle");
		GridBagConstraints gbc_txtpnaxle = new GridBagConstraints();
		gbc_txtpnaxle.insets = new Insets(0, 0, 5, 5);
		gbc_txtpnaxle.fill = GridBagConstraints.BOTH;
		gbc_txtpnaxle.gridx = 9;
		gbc_txtpnaxle.gridy = 14;
		contentPane.add(txtpnaxle, gbc_txtpnaxle);

		textFieldAxle = new JTextField();
		textFieldAxle.setText("0");
		GridBagConstraints gbc_textFieldAxle = new GridBagConstraints();
		gbc_textFieldAxle.anchor = GridBagConstraints.ABOVE_BASELINE;
		gbc_textFieldAxle.gridwidth = 4;
		gbc_textFieldAxle.insets = new Insets(0, 0, 5, 5);
		gbc_textFieldAxle.fill = GridBagConstraints.HORIZONTAL;
		gbc_textFieldAxle.gridx = 12;
		gbc_textFieldAxle.gridy = 14;
		contentPane.add(textFieldAxle, gbc_textFieldAxle);
		textFieldAxle.setColumns(10);

		txtpnAxleCost = new JTextPane();
		txtpnAxleCost.setEditable(false);
		GridBagConstraints gbc_txtpnAxleCost = new GridBagConstraints();
		gbc_txtpnAxleCost.gridwidth = 4;
		gbc_txtpnAxleCost.insets = new Insets(0, 0, 5, 5);
		gbc_txtpnAxleCost.fill = GridBagConstraints.BOTH;
		gbc_txtpnAxleCost.gridx = 16;
		gbc_txtpnAxleCost.gridy = 14;
		contentPane.add(txtpnAxleCost, gbc_txtpnAxleCost);

		/**
		 * Tongue
		 */
		txtpnTongue = new JTextPane();
		txtpnTongue.setText("Tongue");
		GridBagConstraints gbc_txtpnTongue = new GridBagConstraints();
		gbc_txtpnTongue.gridwidth = 4;
		gbc_txtpnTongue.insets = new Insets(0, 0, 5, 5);
		gbc_txtpnTongue.fill = GridBagConstraints.BOTH;
		gbc_txtpnTongue.gridx = 5;
		gbc_txtpnTongue.gridy = 15;
		contentPane.add(txtpnTongue, gbc_txtpnTongue);

		txtpntongue = new JTextPane();
		txtpntongue.setText("Price: $" + tonguePrice + "/tongue, Weight: "
				+ tongueWeight + "pounds/tongue");
		GridBagConstraints gbc_txtpntongue = new GridBagConstraints();
		gbc_txtpntongue.insets = new Insets(0, 0, 5, 5);
		gbc_txtpntongue.fill = GridBagConstraints.BOTH;
		gbc_txtpntongue.gridx = 9;
		gbc_txtpntongue.gridy = 15;
		contentPane.add(txtpntongue, gbc_txtpntongue);

		textFieldTongue = new JTextField();
		textFieldTongue.setText("0");
		GridBagConstraints gbc_textFieldTongue = new GridBagConstraints();
		gbc_textFieldTongue.anchor = GridBagConstraints.ABOVE_BASELINE;
		gbc_textFieldTongue.gridwidth = 4;
		gbc_textFieldTongue.insets = new Insets(0, 0, 5, 5);
		gbc_textFieldTongue.fill = GridBagConstraints.HORIZONTAL;
		gbc_textFieldTongue.gridx = 12;
		gbc_textFieldTongue.gridy = 15;
		contentPane.add(textFieldTongue, gbc_textFieldTongue);
		textFieldTongue.setColumns(10);

		txtpnTongueCost = new JTextPane();
		txtpnTongueCost.setEditable(false);
		GridBagConstraints gbc_txtpnTongueCost = new GridBagConstraints();
		gbc_txtpnTongueCost.gridwidth = 4;
		gbc_txtpnTongueCost.insets = new Insets(0, 0, 5, 5);
		gbc_txtpnTongueCost.fill = GridBagConstraints.BOTH;
		gbc_txtpnTongueCost.gridx = 16;
		gbc_txtpnTongueCost.gridy = 15;
		contentPane.add(txtpnTongueCost, gbc_txtpnTongueCost);

		txtpnCostLabel = new JTextPane();
		txtpnCostLabel.setText("Purchase Cost");
		txtpnCostLabel.setEditable(false);
		GridBagConstraints gbc_txtpnCostLabel = new GridBagConstraints();
		gbc_txtpnCostLabel.gridwidth = 4;
		gbc_txtpnCostLabel.insets = new Insets(0, 0, 5, 5);
		gbc_txtpnCostLabel.fill = GridBagConstraints.BOTH;
		gbc_txtpnCostLabel.gridx = 12;
		gbc_txtpnCostLabel.gridy = 16;
		contentPane.add(txtpnCostLabel, gbc_txtpnCostLabel);

		txtpnTotalCost = new JTextPane();
		txtpnTotalCost.setEditable(false);
		GridBagConstraints gbc_txtpnTotalCost = new GridBagConstraints();
		gbc_txtpnTotalCost.gridwidth = 4;
		gbc_txtpnTotalCost.insets = new Insets(0, 0, 5, 5);
		gbc_txtpnTotalCost.fill = GridBagConstraints.BOTH;
		gbc_txtpnTotalCost.gridx = 16;
		gbc_txtpnTotalCost.gridy = 16;
		contentPane.add(txtpnTotalCost, gbc_txtpnTotalCost);

		txtpnWeightLabel = new JTextPane();
		txtpnWeightLabel.setText("Current Purchase Weight");
		txtpnWeightLabel.setEditable(false);
		GridBagConstraints gbc_txtpnWeightLabel = new GridBagConstraints();
		gbc_txtpnWeightLabel.gridwidth = 4;
		gbc_txtpnWeightLabel.insets = new Insets(0, 0, 5, 5);
		gbc_txtpnWeightLabel.fill = GridBagConstraints.BOTH;
		gbc_txtpnWeightLabel.gridx = 12;
		gbc_txtpnWeightLabel.gridy = 17;
		contentPane.add(txtpnWeightLabel, gbc_txtpnWeightLabel);

		txtpnTotalWeight = new JTextPane();
		txtpnTotalWeight.setEditable(false);
		GridBagConstraints gbc_txtpnTotalWeight = new GridBagConstraints();
		gbc_txtpnTotalWeight.gridwidth = 4;
		gbc_txtpnTotalWeight.insets = new Insets(0, 0, 5, 5);
		gbc_txtpnTotalWeight.fill = GridBagConstraints.BOTH;
		gbc_txtpnTotalWeight.gridx = 16;
		gbc_txtpnTotalWeight.gridy = 17;
		contentPane.add(txtpnTotalWeight, gbc_txtpnTotalWeight);

		btnCalculate = new JButton("Calculate");
		btnCalculate.setBackground(Color.cyan);
		btnCalculate.addActionListener(calculateListener);
		GridBagConstraints gbc_btnCalculate = new GridBagConstraints();
		gbc_btnCalculate.gridwidth = 4;
		gbc_btnCalculate.insets = new Insets(0, 0, 5, 5);
		gbc_btnCalculate.gridx = 9;
		gbc_btnCalculate.gridy = 18;
		contentPane.add(btnCalculate, gbc_btnCalculate);

		btnSealTheDeal = new JButton("Seal the Deal!");
		btnSealTheDeal.setBackground(Color.cyan);
		btnSealTheDeal.addActionListener(calculateListener);
		GridBagConstraints gbc_btnSealTheDeal = new GridBagConstraints();
		gbc_btnSealTheDeal.gridwidth = 4;
		gbc_btnSealTheDeal.insets = new Insets(0, 0, 5, 5);
		gbc_btnSealTheDeal.gridx = 9;
		gbc_btnSealTheDeal.gridy = 19;
		contentPane.add(btnSealTheDeal, gbc_btnSealTheDeal);

		txtpnBrowntourage = new JTextPane();
		txtpnBrowntourage.setEditable(false);
		txtpnBrowntourage.setForeground(Color.BLACK);
		txtpnBrowntourage.setText("Browntourage");
		GridBagConstraints gbc_txtpnBrowntourage = new GridBagConstraints();
		gbc_txtpnBrowntourage.gridwidth = 3;
		gbc_txtpnBrowntourage.fill = GridBagConstraints.BOTH;
		gbc_txtpnBrowntourage.gridx = 18;
		gbc_txtpnBrowntourage.gridy = 23;
		contentPane.add(txtpnBrowntourage, gbc_txtpnBrowntourage);

	}

	/**
	 * @return the isBuy
	 */
	public boolean getIsBuy() {
		return isBuy;
	}

	/**
	 * @param isBuy
	 *            the isBuy to set
	 */
	public void setIsBuy(boolean isBuy) {
		this.isBuy = isBuy;
	}

	/**
	 * Create a private ButtonListener class that will look at the userinput and
	 * updates the panel accordingly.
	 * 
	 * @author Browntourage
	 * 
	 */
	private class ButtonListener implements ActionListener {

		public void actionPerformed(ActionEvent ae) {

			if (ae.getActionCommand() == "Buy") {

				setIsBuy(true);
				System.out.println(isBuy);
			}

			if (ae.getActionCommand() == "Sell") {

				setIsBuy(false);
				System.out.println(isBuy);
			}

		}

	}

	/**
	 * Create another private class that will caculate the price and weight of
	 * all the supplies bought by the user of the game when they enter the
	 * store.
	 * 
	 * @author Browntourage
	 * 
	 */
	private class CalculateListener implements ActionListener {

		public void actionPerformed(ActionEvent ae) {
			double totalPurchase = 0.0;
			double totalWeight = 0.0;
			if (ae.getActionCommand() == "Calculate") {
				System.out.println("pressed calculate");
				if (!rdbtnBuy.isSelected() && !rdbtnSell.isSelected()) {
					JOptionPane.showMessageDialog(null,
							"Please select if you want to buy or sell");
				}

				else {
					try {
						Integer Ammunition = Integer
								.parseInt(textFieldAmmunition.getText());
						Integer Ammunition2 = Integer
								.parseInt(textFieldAmmunition.getText());
						totalPurchase += Ammunition *= bulletPrice;
						totalWeight += Ammunition2 *= bulletWeight;
						txtpnAmmunitionCost
								.setText("$" + Ammunition.toString());

					} catch (Exception e) {
						JOptionPane
								.showMessageDialog(null,
										"Enter a valid integer for the number of bullets you wish to trade");
					}

					try {
						Integer Medicine = Integer.parseInt(textFieldMedicine
								.getText());
						Integer Medicine2 = Integer.parseInt(textFieldMedicine
								.getText());
						totalPurchase += Medicine *= bottlePrice;
						totalWeight += Medicine2 *= bottleWeight;
						txtpnMedicineCost.setText("$" + Medicine.toString());
					} catch (Exception e) {
						JOptionPane
								.showMessageDialog(null,
										"Enter a valid integer for the number of bottles you wish to trade");
					}

					try {
						Integer Food = Integer
								.parseInt(textFieldFood.getText());
						Integer Food2 = Integer.parseInt(textFieldFood
								.getText());
						totalPurchase += Food *= mealPrice;
						totalWeight += Food2 *= mealWeight;
						txtpnFoodCost.setText("$" + Food.toString());
					} catch (Exception e) {
						JOptionPane
								.showMessageDialog(null,
										"Enter a valid integer for the number of meals you wish to trade");
					}

					try {
						Integer Oxen = Integer
								.parseInt(textFieldOxen.getText());
						Integer Oxen2 = Integer.parseInt(textFieldOxen
								.getText());
						totalPurchase += Oxen *= animalPrice;
						totalWeight += Oxen2 *= animalWeight;
						txtpnOxenCost.setText("$" + Oxen.toString());
					} catch (Exception e) {
						JOptionPane
								.showMessageDialog(null,
										"Enter a valid integer for the number of animals you wish to trade");
					}

					try {
						Integer Wheel = Integer.parseInt(textFieldWheel
								.getText());
						Integer Wheel2 = Integer.parseInt(textFieldWheel
								.getText());
						totalPurchase += Wheel *= wheelPrice;
						totalWeight += Wheel2 *= wheelWeight;
						txtpnWheelCost.setText("$" + Wheel.toString());
					} catch (Exception e) {
						JOptionPane
								.showMessageDialog(null,
										"Enter a valid integer for the number of wheels you wish to trade");
					}

					try {
						Integer Axel = Integer
								.parseInt(textFieldAxle.getText());
						Integer Axel2 = Integer.parseInt(textFieldAxle
								.getText());
						totalPurchase += Axel *= axlePrice;
						totalWeight += Axel2 *= axleWeight;
						txtpnAxleCost.setText("$" + Axel.toString());
					} catch (Exception e) {
						JOptionPane
								.showMessageDialog(null,
										"Enter a valid integer for the number of wheels you wish to trade");
					}

					try {
						Integer Tongue = Integer.parseInt(textFieldWheel
								.getText());
						Integer Tongue2 = Integer.parseInt(textFieldWheel
								.getText());
						totalPurchase += Tongue *= tonguePrice;
						totalWeight += Tongue2 *= tongueWeight;
						txtpnTongueCost.setText("$" + Tongue.toString());
					} catch (Exception e) {
						JOptionPane
								.showMessageDialog(null,
										"Enter a valid integer for the number of wheels you wish to trade");
					}

					txtpnTotalCost.setText("$" + totalPurchase);
					txtpnTotalWeight.setText("" + totalWeight);
				}
			}

			if (ae.getActionCommand() == "Seal the Deal!") {
				try {
					Integer Ammunition = Integer.parseInt(textFieldAmmunition
							.getText());
					Integer Ammunition2 = Integer.parseInt(textFieldAmmunition
							.getText());
					totalPurchase += Ammunition *= bulletPrice;
					totalWeight += Ammunition2 *= bulletWeight;
					txtpnAmmunitionCost.setText("$" + Ammunition.toString());

				} catch (Exception e) {
					JOptionPane
							.showMessageDialog(null,
									"Enter a valid integer for the number of bullets you wish to trade");
				}

				try {
					Integer Medicine = Integer.parseInt(textFieldMedicine
							.getText());
					Integer Medicine2 = Integer.parseInt(textFieldMedicine
							.getText());
					totalPurchase += Medicine *= bottlePrice;
					totalWeight += Medicine2 *= bottleWeight;
					txtpnMedicineCost.setText("$" + Medicine.toString());
				} catch (Exception e) {
					JOptionPane
							.showMessageDialog(null,
									"Enter a valid integer for the number of bottles you wish to trade");
				}

				try {
					Integer Food = Integer.parseInt(textFieldFood.getText());
					Integer Food2 = Integer.parseInt(textFieldFood.getText());
					totalPurchase += Food *= mealPrice;
					totalWeight += Food2 *= mealWeight;
					txtpnFoodCost.setText("$" + Food.toString());
				} catch (Exception e) {
					JOptionPane
							.showMessageDialog(null,
									"Enter a valid integer for the number of meals you wish to trade");
				}

				try {
					Integer Oxen = Integer.parseInt(textFieldOxen.getText());
					Integer Oxen2 = Integer.parseInt(textFieldOxen.getText());
					totalPurchase += Oxen *= animalPrice;
					totalWeight += Oxen2 *= animalWeight;
					txtpnOxenCost.setText("$" + Oxen.toString());
				} catch (Exception e) {
					JOptionPane
							.showMessageDialog(null,
									"Enter a valid integer for the number of animals you wish to trade");
				}

				try {
					Integer Wheel = Integer.parseInt(textFieldWheel.getText());
					Integer Wheel2 = Integer.parseInt(textFieldWheel.getText());
					totalPurchase += Wheel *= wheelPrice;
					totalWeight += Wheel2 *= wheelWeight;
					txtpnWheelCost.setText("$" + Wheel.toString());
				} catch (Exception e) {
					JOptionPane
							.showMessageDialog(null,
									"Enter a valid integer for the number of wheels you wish to trade");
				}

				try {
					Integer Axel = Integer.parseInt(textFieldAxle.getText());
					Integer Axel2 = Integer.parseInt(textFieldAxle.getText());
					totalPurchase += Axel *= axlePrice;
					totalWeight += Axel2 *= axleWeight;
					txtpnAxleCost.setText("$" + Axel.toString());
				} catch (Exception e) {
					JOptionPane
							.showMessageDialog(null,
									"Enter a valid integer for the number of wheels you wish to trade");
				}

				try {
					Integer Tongue = Integer.parseInt(textFieldWheel.getText());
					Integer Tongue2 = Integer
							.parseInt(textFieldWheel.getText());
					totalPurchase += Tongue *= tonguePrice;
					totalWeight += Tongue2 *= tongueWeight;
					txtpnTongueCost.setText("$" + Tongue.toString());
				} catch (Exception e) {
					JOptionPane
							.showMessageDialog(null,
									"Enter a valid integer for the number of wheels you wish to trade");
				}
				if ((pControl.getCash() - totalPurchase) < 0) {
					JOptionPane.showMessageDialog(null,
							"You do not have enough money for this purchase.");
				} else {
					double newMoney = pControl.getCash() - totalPurchase;

					pControl.setCash(newMoney);
					System.out.println("salary" + pControl.getCash());
					System.out.println("TP" + totalPurchase);
					System.out.println("newMoney" + newMoney);
					lblCurrentMoney.setText("Current Money: " + newMoney);

				}
				if (totalWeight > wagon.getMAX()) {
					JOptionPane.showMessageDialog(null,
							"You exceded the max weight.");
				} else {
					wagon.setWeight(totalWeight);
					lblCurrentWeight.setText("Current Weight: " + totalWeight);
				}

				if (totalWeight < wagon.getMAX()
						&& (pControl.getCash() - totalPurchase) > 0) {
					System.out.println("calculating inventory");
					Integer Ammunition = Integer.parseInt(textFieldAmmunition
							.getText());
					for (int a = 0; a < Ammunition; a++) {
						Ammunition amo = new Ammunition(bulletPrice,
								bulletWeight);
						wagon.getSupplyList().add(amo);
					}

					Integer Medicine = Integer.parseInt(textFieldMedicine
							.getText());
					for (int a = 0; a < Medicine; a++) {
						Medicine med = new Medicine(bottlePrice, bottleWeight);
						wagon.getSupplyList().add(med);
					}

					Integer Food = Integer.parseInt(textFieldFood.getText());
					for (int a = 0; a < Food; a++) {
						Food food = new Food(mealPrice, mealWeight);
						wagon.getSupplyList().add(food);
					}

					Integer Oxen = Integer.parseInt(textFieldOxen.getText());
					for (int a = 0; a < Oxen; a++) {
						Oxen ox = new Oxen(mealPrice, mealWeight, 100);
						wagon.getSupplyList().add(ox);
					}

					Integer Wheel = Integer.parseInt(textFieldWheel.getText());
					for (int a = 0; a < Wheel; a++) {
						Wheel wheel = new Wheel(wheelPrice, wheelWeight);
						wagon.getSupplyList().add(wheel);
					}

					Integer Axel = Integer.parseInt(textFieldAxle.getText());
					for (int a = 0; a < Axel; a++) {
						Axle axle = new Axle(axlePrice, axleWeight);
						wagon.getSupplyList().add(axle);
					}

					Integer Tongue = Integer
							.parseInt(textFieldTongue.getText());
					for (int a = 0; a < Tongue; a++) {
						Tongue tongue = new Tongue(tonguePrice, tongueWeight);
						wagon.getSupplyList().add(tongue);
					}

					for (int x = 0; x < wagon.getSupplyList().size(); x++) {
						System.out.println(wagon.getSupplyList().get(x));
					}
				

				}
				MainScreen mScreen = new MainScreen(pControl);
				mScreen.setVisible(true);
			}
		}
	}

	public class MainScreen extends JFrame {
		// Declare all the text fields, radiobuttons, textpanes, player control
		// and profession class.
	/*	private int amount;
		private Rations rations;
		private int amount2;
		private Pace pace;*/
		private PlayerControl pControl;
		private int distance; 

		private JPanel contentPane;

		private JRadioButton rdbtnSlow;
		private JRadioButton rdbtnMedium;
		private JRadioButton rdbtnFast;

		private final ButtonGroup PaceGroup = new ButtonGroup();

		private JRadioButton rdbtnOne;
		private JRadioButton rdbtnTwo;
		private JRadioButton rdbtnThree;

		private final ButtonGroup RationsGroup = new ButtonGroup();

		private JTextPane txtpnMain;
		private JTextPane txtpnBrowntourage;

		private JTextPane txtpnDistTravelled;
		private JTextPane txtpnDist;

		private JTextPane txtpnFoodLabel;
		private JTextPane txtpnFood;

		private JTextPane txtpnRationsLabel;
		private JTextPane txtpnRations;

		private JTextPane txtpnPaceLabel;
		private JTextPane txtpnPace;

		private JTextPane txtpnChangePace;
		private JTextPane txtpnChangeRations;

		private JButton btnTakeTurn;


		/**
		 * Create the frame.
		 */
		public MainScreen(PlayerControl control) {
			this.pControl = control; 
			setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
			setBounds(100, 100, 661, 592);
			contentPane = new JPanel();
			contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
			contentPane.setBackground(Color.orange);
			setContentPane(contentPane);
			GridBagLayout gbl_contentPane = new GridBagLayout();
			gbl_contentPane.columnWidths = new int[] { 0, 0, 0, 0, 0, 0, 0, 0,
					0, 127, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
			gbl_contentPane.rowHeights = new int[] { 25, 25, 25, 25, 25, 25,
					25, 25, 25, 25, 22, 25, 22, 26, 25, 0, 0, 0, 0 };
			gbl_contentPane.columnWeights = new double[] { 0.0, 0.0, 0.0, 0.0,
					1.0, 1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0,
					1.0, 0.0, 0.0, 1.0, Double.MIN_VALUE };
			gbl_contentPane.rowWeights = new double[] { 1.0, 1.0, 0.0, 0.0,
					0.0, 0.0, 0.0, 1.0, 1.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
					0.0, 0.0, Double.MIN_VALUE };
			contentPane.setLayout(gbl_contentPane);
			RadioButtonListener RadioListener = new RadioButtonListener();
			ButtonListener ButtonListener = new ButtonListener();

			txtpnMain = new JTextPane();
			txtpnMain.setEditable(false);
			txtpnMain.setText("How would you like to proceed on the trail?");
			GridBagConstraints gbc_txtpnMain = new GridBagConstraints();
			gbc_txtpnMain.insets = new Insets(0, 0, 5, 5);
			gbc_txtpnMain.fill = GridBagConstraints.BOTH;
			gbc_txtpnMain.gridx = 9;
			gbc_txtpnMain.gridy = 0;
			contentPane.add(txtpnMain, gbc_txtpnMain);

			/**
			 * Total Distance Travelled
			 */

			txtpnDistTravelled = new JTextPane();
			txtpnDistTravelled.setText("Total Distance Travelled:");
			GridBagConstraints gbc_txtpnDistTravelled = new GridBagConstraints();
			gbc_txtpnDistTravelled.gridwidth = 5;
			gbc_txtpnDistTravelled.insets = new Insets(0, 0, 5, 5);
			gbc_txtpnDistTravelled.fill = GridBagConstraints.BOTH;
			gbc_txtpnDistTravelled.gridx = 5;
			gbc_txtpnDistTravelled.gridy = 2;
			contentPane.add(txtpnDistTravelled, gbc_txtpnDistTravelled);

			txtpnDist = new JTextPane();
			txtpnDist.setText(pControl.getTotalDistance()+"");
			GridBagConstraints gbc_txtpnDist = new GridBagConstraints();
			gbc_txtpnDist.gridwidth = 4;
			gbc_txtpnDist.insets = new Insets(0, 0, 5, 5);
			gbc_txtpnDist.fill = GridBagConstraints.BOTH;
			gbc_txtpnDist.gridx = 12;
			gbc_txtpnDist.gridy = 2;
			contentPane.add(txtpnDist, gbc_txtpnDist);

			/**
			 * Food Left
			 */

			txtpnFoodLabel = new JTextPane();
			txtpnFoodLabel.setText("Food Left:");
			GridBagConstraints gbc_txtpnFoodLabel = new GridBagConstraints();
			gbc_txtpnFoodLabel.gridwidth = 5;
			gbc_txtpnFoodLabel.insets = new Insets(0, 0, 5, 5);
			gbc_txtpnFoodLabel.fill = GridBagConstraints.BOTH;
			gbc_txtpnFoodLabel.gridx = 5;
			gbc_txtpnFoodLabel.gridy = 3;
			contentPane.add(txtpnFoodLabel, gbc_txtpnFoodLabel);

			txtpnFood = new JTextPane();
			txtpnFood.setText(wagon.getFood()+"");
			GridBagConstraints gbc_txtpnFood = new GridBagConstraints();
			gbc_txtpnFood.gridwidth = 4;
			gbc_txtpnFood.insets = new Insets(0, 0, 5, 5);
			gbc_txtpnFood.fill = GridBagConstraints.BOTH;
			gbc_txtpnFood.gridx = 12;
			gbc_txtpnFood.gridy = 3;
			contentPane.add(txtpnFood, gbc_txtpnFood);
			/**
			 * Current Rations
			 */

			txtpnRationsLabel = new JTextPane();
			txtpnRationsLabel.setText("Current Rations:");
			GridBagConstraints gbc_txtpnRationsLabel = new GridBagConstraints();
			gbc_txtpnRationsLabel.gridwidth = 5;
			gbc_txtpnRationsLabel.insets = new Insets(0, 0, 5, 5);
			gbc_txtpnRationsLabel.fill = GridBagConstraints.BOTH;
			gbc_txtpnRationsLabel.gridx = 5;
			gbc_txtpnRationsLabel.gridy = 4;
			contentPane.add(txtpnRationsLabel, gbc_txtpnRationsLabel);

			txtpnRations = new JTextPane();
			txtpnRations.setText(pControl.getRations() + "");
			GridBagConstraints gbc_txtpnRations = new GridBagConstraints();
			gbc_txtpnRations.gridwidth = 4;
			gbc_txtpnRations.insets = new Insets(0, 0, 5, 5);
			gbc_txtpnRations.fill = GridBagConstraints.BOTH;
			gbc_txtpnRations.gridx = 12;
			gbc_txtpnRations.gridy = 4;
			contentPane.add(txtpnRations, gbc_txtpnRations);

			/**
			 * Current Pace
			 */

			txtpnPaceLabel = new JTextPane();
			txtpnPaceLabel.setText("Current Pace:");
			GridBagConstraints gbc_txtpnPaceLabel = new GridBagConstraints();
			gbc_txtpnPaceLabel.gridwidth = 5;
			gbc_txtpnPaceLabel.insets = new Insets(0, 0, 5, 5);
			gbc_txtpnPaceLabel.fill = GridBagConstraints.BOTH;
			gbc_txtpnPaceLabel.gridx = 5;
			gbc_txtpnPaceLabel.gridy = 5;
			contentPane.add(txtpnPaceLabel, gbc_txtpnPaceLabel);

			txtpnPace = new JTextPane();
			txtpnPace.setText(pControl.getPace() + "");
			GridBagConstraints gbc_txtpnPace = new GridBagConstraints();
			gbc_txtpnPace.gridwidth = 4;
			gbc_txtpnPace.insets = new Insets(0, 0, 5, 5);
			gbc_txtpnPace.fill = GridBagConstraints.BOTH;
			gbc_txtpnPace.gridx = 12;
			gbc_txtpnPace.gridy = 5;
			contentPane.add(txtpnPace, gbc_txtpnPace);

			/**
			 * Change Pace
			 */

			txtpnChangePace = new JTextPane();
			txtpnChangePace.setText("Change Pace");
			GridBagConstraints gbc_txtpnChangePace = new GridBagConstraints();
			gbc_txtpnChangePace.gridwidth = 4;
			gbc_txtpnChangePace.insets = new Insets(0, 0, 5, 5);
			gbc_txtpnChangePace.fill = GridBagConstraints.BOTH;
			gbc_txtpnChangePace.gridx = 5;
			gbc_txtpnChangePace.gridy = 6;
			contentPane.add(txtpnChangePace, gbc_txtpnChangePace);

			/**
			 * Change Rations
			 */

			txtpnChangeRations = new JTextPane();
			txtpnChangeRations.setText("Change Rations");
			GridBagConstraints gbc_txtpnChangeRations = new GridBagConstraints();
			gbc_txtpnChangeRations.gridwidth = 4;
			gbc_txtpnChangeRations.insets = new Insets(0, 0, 5, 5);
			gbc_txtpnChangeRations.fill = GridBagConstraints.BOTH;
			gbc_txtpnChangeRations.gridx = 12;
			gbc_txtpnChangeRations.gridy = 6;
			contentPane.add(txtpnChangeRations, gbc_txtpnChangeRations);

			/**
			 * 
			 * Pace Buttons
			 */

			rdbtnSlow = new JRadioButton("Slow");
			rdbtnSlow.setBackground(Color.orange);
			rdbtnSlow.addActionListener(RadioListener);
			PaceGroup.add(rdbtnSlow);
			GridBagConstraints gbc_rdbtnSlow = new GridBagConstraints();
			gbc_rdbtnSlow.gridwidth = 2;
			gbc_rdbtnSlow.insets = new Insets(0, 0, 5, 5);
			gbc_rdbtnSlow.anchor = GridBagConstraints.WEST;
			gbc_rdbtnSlow.gridx = 5;
			gbc_rdbtnSlow.gridy = 7;
			contentPane.add(rdbtnSlow, gbc_rdbtnSlow);

			rdbtnMedium = new JRadioButton("Medium");
			rdbtnMedium.setBackground(Color.orange);
			rdbtnMedium.addActionListener(RadioListener);
			PaceGroup.add(rdbtnMedium);
			GridBagConstraints gbc_rdbtnMedium = new GridBagConstraints();
			gbc_rdbtnMedium.gridwidth = 3;
			gbc_rdbtnMedium.insets = new Insets(0, 0, 5, 5);
			gbc_rdbtnMedium.anchor = GridBagConstraints.WEST;
			gbc_rdbtnMedium.gridx = 5;
			gbc_rdbtnMedium.gridy = 8;
			contentPane.add(rdbtnMedium, gbc_rdbtnMedium);

			rdbtnFast = new JRadioButton("Fast");
			rdbtnFast.setBackground(Color.orange);
			rdbtnFast.addActionListener(RadioListener);
			PaceGroup.add(rdbtnFast);
			GridBagConstraints gbc_rdbtnFast = new GridBagConstraints();
			gbc_rdbtnFast.gridwidth = 2;
			gbc_rdbtnFast.insets = new Insets(0, 0, 5, 5);
			gbc_rdbtnFast.anchor = GridBagConstraints.WEST;
			gbc_rdbtnFast.gridx = 5;
			gbc_rdbtnFast.gridy = 9;
			contentPane.add(rdbtnFast, gbc_rdbtnFast);

			/**
			 * Rations Buttons
			 */
			rdbtnOne = new JRadioButton("One");
			rdbtnOne.setBackground(Color.orange);
			rdbtnOne.addActionListener(RadioListener);
			RationsGroup.add(rdbtnOne);
			GridBagConstraints gbc_rdbtnOne = new GridBagConstraints();
			gbc_rdbtnOne.insets = new Insets(0, 0, 5, 5);
			gbc_rdbtnOne.anchor = GridBagConstraints.WEST;
			gbc_rdbtnOne.gridx = 12;
			gbc_rdbtnOne.gridy = 7;
			contentPane.add(rdbtnOne, gbc_rdbtnOne);

			rdbtnTwo = new JRadioButton("Two");
			rdbtnTwo.setBackground(Color.orange);
			rdbtnTwo.addActionListener(RadioListener);
			RationsGroup.add(rdbtnTwo);
			GridBagConstraints gbc_rdbtnTwo = new GridBagConstraints();
			gbc_rdbtnTwo.insets = new Insets(0, 0, 5, 5);
			gbc_rdbtnTwo.anchor = GridBagConstraints.WEST;
			gbc_rdbtnTwo.gridx = 12;
			gbc_rdbtnTwo.gridy = 8;
			contentPane.add(rdbtnTwo, gbc_rdbtnTwo);

			rdbtnThree = new JRadioButton("Three");
			rdbtnThree.setBackground(Color.orange);
			rdbtnThree.addActionListener(RadioListener);
			RationsGroup.add(rdbtnThree);
			GridBagConstraints gbc_rdbtnThree = new GridBagConstraints();
			gbc_rdbtnThree.insets = new Insets(0, 0, 5, 5);
			gbc_rdbtnThree.anchor = GridBagConstraints.WEST;
			gbc_rdbtnThree.gridx = 12;
			gbc_rdbtnThree.gridy = 9;
			contentPane.add(rdbtnThree, gbc_rdbtnThree);

			/**
			 * Take Turn Button
			 */
			btnTakeTurn = new JButton("Take a Turn!");
			btnTakeTurn.setBackground(Color.cyan);
			btnTakeTurn.addActionListener(ButtonListener);
			GridBagConstraints gbc_btnTakeTurn = new GridBagConstraints();
			gbc_btnTakeTurn.gridwidth = 4;
			gbc_btnTakeTurn.insets = new Insets(0, 0, 5, 5);
			gbc_btnTakeTurn.gridx = 9;
			gbc_btnTakeTurn.gridy = 13;
			contentPane.add(btnTakeTurn, gbc_btnTakeTurn);

			/**
			 * Browntourage Label
			 */
			txtpnBrowntourage = new JTextPane();
			txtpnBrowntourage.setEditable(false);
			txtpnBrowntourage.setForeground(Color.BLACK);
			txtpnBrowntourage.setText("Browntourage");
			GridBagConstraints gbc_txtpnBrowntourage = new GridBagConstraints();
			gbc_txtpnBrowntourage.gridwidth = 3;
			gbc_txtpnBrowntourage.fill = GridBagConstraints.BOTH;
			gbc_txtpnBrowntourage.gridx = 18;
			gbc_txtpnBrowntourage.gridy = 17;
			contentPane.add(txtpnBrowntourage, gbc_txtpnBrowntourage);

		}

		private class RadioButtonListener implements ActionListener {

			public void actionPerformed(ActionEvent ae) {
				if (ae.getActionCommand() == "Slow") {
					pControl.setSpeed(10.00);
					pControl.setPace(pControl.getSpeed());
					pControl.updateDistance(40); 
					System.out.println("Pace: " + pControl.getPace());

				}

				if (ae.getActionCommand() == "Medium") {
					pControl.setSpeed(15.00);
					pControl.setPace(pControl.getSpeed());
					pControl.updateDistance(80);
					System.out.println("Pace: " + pControl.getPace());
				}
				if (ae.getActionCommand() == "Fast") {
					pControl.setSpeed(20.00);
					pControl.setPace(pControl.getSpeed());
					pControl.updateDistance(80);
					System.out.println("Pace: " + pControl.getPace());
				}
				if (ae.getActionCommand() == "One") {
					pControl.setAmount(1);
					pControl.setRations(pControl.getAmount());
					System.out.println("Rations: " + pControl.getRations());
				}
				if (ae.getActionCommand() == "Two") {
					pControl.setAmount(2);
					pControl.setRations(pControl.getAmount());
					System.out.println("Rations: " + pControl.getRations());
				}
				if (ae.getActionCommand() == "Three") {
					pControl.setAmount(3);
					pControl.setRations(pControl.getAmount());
					System.out.println("Rations: " + pControl.getRations());
				}

			}

		}

		private class ButtonListener implements ActionListener {

			public void actionPerformed(ActionEvent ae) {
				if(ae.getActionCommand() == "Take a Turn!"){
					int troopSize = pControl.getTroop().length + 1;
					int totalRations = (int) (pControl.getRations() * troopSize);
					int currentRations = (int) wagon.getFood();
					if(currentRations - totalRations > 0){
						wagon.setFood(currentRations - totalRations);

						//txtpnFood.setText("Hello");
						txtpnRations.setText(pControl.getRations() + "");
						txtpnPace.setText(pControl.getPace() + "");
						txtpnFood.setText(wagon.getFood()+"");
						txtpnDist.setText(pControl.getTotalDistance()+"");
					}
					else{
						JOptionPane.showMessageDialog(null, "You are consuming too much!");
					}
				}

			}
		}
	}

}
